package main

import (
	"fmt"
)

func main() {
	var str1 = "hello"
	str2 := "world"

	str3 := fmt.Sprintf("%s   %s", str1, str2)
	n := len(str3)
	fmt.Println(str3)
	fmt.Printf("len(str3)=%d\n", n)
	substr := str3[0:7]
	fmt.Println(substr)
	substr = str3[8:]
	fmt.Println(substr)
	fmt.Println(reverse(str3))
	fmt.Println(reverse1(str3))

}

func reverse(str1 string) string {
	strLen := len(str1)
	var str string
	for index := 0; index < strLen; index++ {
		str += str1[strLen-index-1 : strLen-index]
	}
	return str
}

func reverse1(str string) string {
	var result []byte
	temp := []byte(str)
	length := len(temp)
	for i := 0; i < length; i++ {
		result = append(result, temp[length-i-1])
	}
	return string(result)
}
